package com.adou.multi.multi_tenancy.listener;

import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;

import com.adou.multi.multi_tenancy.domain.entity.TenantAware;
import com.adou.multi.multi_tenancy.util.TeanantContext;

public class TenantListenter {
	@PreUpdate
	@PreRemove
	@PrePersist
	public void setTeanant(TenantAware entity){
		final String tenantId = TeanantContext.getTenantId();
		entity.setTenantId(tenantId);
	}
}
